package tech.aistar.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tech.aistar.pojo.UserCollectionVo;

import java.util.List;

public interface UserCollectionMapper {
    // 连接查询userCollection和product，显示在我的收藏页面,通过userid来查找收藏的内容
    @Select("select c.id,c.user_id,p.id,product_id,p.price,p.name,p.img_url,p.description from user_collection c \n" +
            "join product p on c.product_id = p.id where c.user_id=#{value}")
    List<UserCollectionVo> findByUserId(Integer userId);
    
//     通过图片id来删除收藏的图片
    @Delete("delete  from user_collection where id = #{value}")
    boolean delPCollectionId(Integer collectionId);
    
    
    boolean delPCollectionIds(@Param("collectionIds") List<Integer> collectionIds);
    
}
